<template>
  <nav>
    <div class="banxin tanxin nav_box">
      <img src="../assets/images/indexLogo.png" alt="" />
      <ul class="tanxin">
        <li :class="{ active: $route.path == '/' }" @click="$router.push('/')">
          首页
        </li>
        <li
          :class="{ active: $route.path == '/goods' }"
          @click="$router.push('/goods')"
        >
          全部商品
        </li>
        <li
          :class="{ active: $route.path == '/user' }"
          @click="$router.push('/user')"
        >
          个人中心
        </li>
        <li
          :class="{ active: $route.path == '/myOrder' }"
          @click="$router.push('/myOrder')"
        >
          我的订单
        </li>
        <li
          :class="{ active: $route.path == '/myfree' }"
          @click="$router.push('/myfree')"
        >
          专属福利
        </li>
      </ul>
      <div class="search tanxin">
        <input
          type="text"
          class="search"
          placeholder="搜索全部商品直接回车"
          v-model="$store.state.inpVal"
          @keyup.13="bdCl"
        />
        <div class="btn" @click="bdCl">
          <img src="../assets/images/search.png" alt="" />
        </div>
      </div>
    </div>
  </nav>
</template>

<script>
import { getHomeMultidata } from "@/request/api";
export default {
  data() {
    return {};
  },
  methods: {
    bdCl() {
      this.$router.push(`/goods?keyword=${this.$store.state.inpVal}`)
    }
  },components:{
    
  }
};
</script>
 
<style lang = "less" scoped>
@import "../assets/base.less";

nav {
  background: #fff;

  .nav_box {
    align-items: center;
    height: 100px;

    ul {
      width: 500px;

      li {
        font-size: 16px;
        color: @black;
        cursor: pointer;

        a {
          text-decoration: none;
          color: @black;
        }

        &.active {
          color: @blue;
          font-weight: bold;
          a {
            color: @blue;
          }
        }
      }
    }

    .search {
      width: 264px;
      height: 40px;
      overflow: hidden;

      input {
        width: 214px;
        height: 40px;
        border: 1px solid #dedede;
        border-radius: 20px 0px 0px 20px;
        box-sizing: border-box;
        border-right: 0;
        text-indent: 1em;
        outline: none;
      }

      .btn {
        width: 50px;
        height: 40px;
        background: @blue;
        display: flex;
        justify-content: center;
        align-items: center;
        cursor: pointer;
        border-radius: 0 20px 20px 0;
      }
    }
  }
}
</style>